/**
 * \file XMLParser.h
 * \brief XMLParser declaration class
 * \author Edouard ROGE
 * \date 16 October 2012
 */

#ifndef _XML_PARSER_
#define _XML_PARSER_

#include "Core/File/URI.h"
#include "Core/Memory/HeapObject.h"

namespace Core
{
	namespace File
	{
		class XMLNode;

		/**
		 * \class XMLParser
		 * \brief Parser XML. can Load a xml file or Save into xml file
		 */
		class XMLParser : public Memory::HeapObject
		{
		public:

			/**
			 * \fn XMLParser();
			 * \brief Default constructor
			 */
			XMLParser();

			/**
			 * \fn virtual ~XMLParser();
			 * \brief Destructor
			 */
			virtual ~XMLParser();

			/**
			 * \fn XMLNode * Load(const char * _filename);
			 * \param _filename file path of the file to load
			 * \return the xml root element
			 * \brief Load a xml file
			 */
			XMLNode * Load(const char * _filename);

			/**
			 * \fn XMLNode * Load(const String & _filename);
			 * \param _filename file path of the file to load
			 * \return the xml root element
			 * \brief Load a xml file
			 */
			XMLNode * Load(const std::string & _filename);

			/**
			 * \fn XMLNode * Load(const URI & _filename);
			 * \param _filename file path of the file to load
			 * \return the xml root element
			 * \brief Load a xml file
			 */
			XMLNode * Load(const URI & _filename);

			/**
			 * \fn void Save(const char * _filename);
			 * \param _filename file path of the saving file
			 * \return errOK if succeeded
			 * \brief Save into a xml file
			 */
			error Save(const char * _filename);

			/**
			 * \fn void Save(const String & _filename);
			 * \param _filename file path of the saving file
			 * \return errOK if succeeded
			 * \brief Save into a xml file
			 */
			error Save(const std::string & _filename);

			/**
			 * \fn void Save(const URI & _filename);
			 * \param _filename file path of the saving file
			 * \return errOK if succeeded
			 * \brief Save into a xml file
			 */
			error Save(const URI & _filename);

			/**
			 * \fn void SetRootNode(XMLNode * _pNode);
			 * \param _pNode the new root node
			 * \brief Set a root node to the parser
			 */
			void SetRootNode(XMLNode * _pNode);

		private:

			/** XML root node */
			XMLNode * m_pRoot;
		};
	}
}

#endif // _XML_PARSER_
